<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>
        后台管理系统
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" th:href="@{/assets/admin/css/font.css}">
    <link rel="stylesheet" th:href="@{/assets/admin/css/xadmin.css}">
    <script th:src="@{/assets/admin/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/assets/admin/js/xadmin.js}"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>基本设置</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon"
                                                                        style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body layui-card">
    <div class="layui-card-body ">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <ul class="layui-tab-title">
                <li class="layui-this">网站设置</li>
                <li>安全设置</li>
                <li>邮件设置</li>
                <li>关闭网站</li>
                <li>页面设置</li>
                <li>其它设置</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>网站名称
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="title" autocomplete="off" placeholder="控制在25个字、50个字节以内"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>关键词
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="title" autocomplete="off" placeholder="5个左右,8汉字以内,用英文,隔开"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>描述
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="title" autocomplete="off" placeholder="空制在80个汉字，160个字符以内"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>css、js、images路径配置
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="title" autocomplete="off" placeholder="默认为空，为相对路径"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>上传目录配置
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="title" autocomplete="off" placeholder="默认为uploadfile"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>底部版权信息
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="title" autocomplete="off" placeholder="&copy; 2017 风羽"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>备案号
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="title" autocomplete="off" placeholder="ICP备xxxxxxx号"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>统计代码
                            </label>
                            <div class="layui-input-block">
                                <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" lay-submit="" lay-filter="*">
                                保存
                            </button>
                        </div>
                    </form>
                    <div style="height:100px;"></div>
                </div>
                <div class="layui-tab-item">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>允许访问后台的IP列表
                            </label>
                            <div class="layui-input-block">
                                <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>最大次数
                            </label>
                            <div class="layui-input-inline">
                                <input type="number" name="number" lay-verify="number" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" lay-submit="" lay-filter="*">
                                保存
                            </button>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>SMTP服务器
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="host" autocomplete="off" placeholder="smtp.qq.com"
                                       class="layui-input" th:value="${EMAIL_SETTING != null ? EMAIL_SETTING.host :''}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>SMTP 端口
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="port" autocomplete="off" placeholder="25"
                                       class="layui-input" th:value="${EMAIL_SETTING != null ?EMAIL_SETTING.port :''}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>邮箱帐号
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="username" autocomplete="off" placeholder="邮件服务商申请的帐号"
                                       class="layui-input" th:value="${EMAIL_SETTING != null ?EMAIL_SETTING.username :''}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>邮箱密码
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="password" autocomplete="off" placeholder="邮件服务商申请的密码"
                                       class="layui-input" th:value="${EMAIL_SETTING != null ? EMAIL_SETTING.password:''}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" lay-submit="" lay-filter="saveEmailSettingInfo">
                                保存
                            </button>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item">
                    <form class="layui-form">
                        <div class="layui-form-item">
                            <label for="AppId" class="layui-form-label">
                                <span class="x-red">*</span>是否开启
                            </label>
                            <div class="layui-input-block">
                                <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest"
                                       title="开关">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="L_repass" class="layui-form-label">
                            </label>
                            <button class="layui-btn" lay-filter="*" lay-submit="">
                                保存
                            </button>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item">
                    <form class="layui-form layui-form-pane" action="return false;" method="post">
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:145px;">
                                登陆页面图片URI
                            </label>
                            <div class="layui-input-block" style="margin-left:145px;">
                                <input type="text" name="loginImgUri" autocomplete="off" placeholder="支持网络的URI"
                                       class="layui-input" th:value="${PAGE_SETTING != null ? PAGE_SETTING.loginImgUri: ''}">
                                <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="previewLogin">预览登录页面</button>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" lay-submit="" lay-filter="pageProperties">
                                保存
                            </button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-tab-item">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>系统日志
                        </label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="sysLogConfig" id="sysLogConfig" lay-skin="switch" lay-text="开启|关闭"
                                   lay-filter="switchTest">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>其它功能
                        </label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="sysLogConfig" id="otherSet" lay-skin="switch" lay-text="开启|关闭"
                                   lay-filter="switchTest">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn" lay-submit="" lay-filter="*">
                            保存
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/assets/admin/js/jquery.min.js}"></script>
<script th:replace="systemCommon/HarinCommon :: commonJs"></script>
<script>
    layui.use(['element', 'layer', 'form'], function () {
        $ = layui.jquery;//jquery
        lement = layui.element;//面包导航
        layer = layui.layer;//弹出层
        form = layui.form

        form.on("submit(saveEmailSettingInfo)",function(data){
            $.ajax({
                url: "/system/set/EMAIL_SETTING",
                type:"POST",
                data : JSON.stringify(data.field),
                contentType: 'application/json',
                success:function(data){
                    if (data.code == 200) {
                        layer.alert(data.message, {icon: 6}, function (iIndex) {
                            layer.close(iIndex);
                        });
                    } else {
                        layer.alert(data.message, {icon: 5}, function (iIndex) {
                            layer.close(iIndex);
                        });
                    }
                }
            })
            return false;
        });

        //监听提交
        // form.on('submit(*)', function (data) {
        //     //console.log(data);
        //     //发异步，把数据提交给php
        //     layer.alert("保存成功", {icon: 6});
        //     return false;
        // });
        form.on('submit(pageProperties)', function (data) {
            console.log(data.field);
            $.ajax({
                url: "/system/set/PAGE_SETTING",
                type:"POST",
                data : JSON.stringify(data.field),
                contentType: 'application/json',
                success:function(data){
                    if (data.code == 200) {
                        layer.alert(data.message, {icon: 6}, function (iIndex) {
                            layer.close(iIndex);
                        });
                    } else {
                        layer.alert(data.message, {icon: 5}, function (iIndex) {
                            layer.close(iIndex);
                        });
                    }
                }
            })
            return false;
        });
        form.on('submit(previewLogin)',function(data){
            openLayer("预览登录页面", "/login",null,null,null,null);
        });

    });
</script>

</body>
</html>